#define Max 10000
#include <iostream>
using namespace std;
int a[Max][Max];
int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			a[i][j] = Max;
		}
	}
	for (int i = 0; i < m; i++)
	{
		int k, l;
		cin >> k >> l;
		a[k][l] = 1;
		a[l][k] = 1;
	}
	int count = 0;
	while (count < n)
	{
		for (int i = 0; i < n; i++)
		{
			if (a[count][i] != Max)
			{
				for (int j = 0; j < n; j++)
				{
					if ((a[j][count] + a[count][i] < a[j][i]))
					{
						a[j][i] = a[j][count] + a[count][i];
					}
				}
			}
		}
		count++;
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (a[i][j] > 6)
			{
				cout << "No";
				return 0;
			}
		}
	}
	cout << "Yes";
	return 0;
}